<template>
  <div class="dashboard-editor-container" >
    <div >
    <el-row :gutter="40" class="panel-group">
      <!-- <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel" @click="handleSetLineChartData('1')">
          <div class="card-panel-icon-wrapper icon-people">
            <svg-icon icon-class="peoples" class-name="card-panel-icon"  />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">平台用户</div>
            <count-to :start-val="0" :end-val="countData.sysUserCount" :duration="2600" class="card-panel-num" />
          </div>
        </div>
      </el-col> -->
      <el-col :xs="12" :sm="12" :lg="8" class="card-panel-col">
        <div class="card-panel" @click="handleSetLineChartData('2')">
          <div class="card-panel-icon-wrapper icon-message">
            <svg-icon icon-class="peoples" class-name="card-panel-icon"  />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">学生总数</div>
            <div style="float:right">
              <count-to :start-val="0" :end-val="countData.studenCount" :duration="3000" class="card-panel-num" />
            </div>
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="8" class="card-panel-col">
        <div class="card-panel" @click="handleSetLineChartData('3')">
          <div class="card-panel-icon-wrapper icon-money">
            <svg-icon icon-class="star" class-name="card-panel-icon"  />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">班级总数</div>
            <div style="float:right">
              <count-to :start-val="0" :end-val="countData.schoolClassCount" :duration="3200" class="card-panel-num" />
            </div>
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="8" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-shoppingCard">
            <svg-icon icon-class="wechat" class-name="card-panel-icon"  />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">微信公众号授权总数</div>
              <div style="float:right">
                <count-to :start-val="0" :end-val="countData.parentBindCount" :duration="3600" class="card-panel-num" />
              </div>
          </div>
        </div>
      </el-col>
      <!-- <el-col :xs="12" :sm="12" :lg="8" class="card-panel-col">
        <div class="card-panel" @click="handleSetLineChartData('4')">
          <div class="card-panel-icon-wrapper icon-shoppingCard">
            <svg-icon icon-class="peoples" class-name="card-panel-icon"  />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">违纪总数</div>
            <count-to :start-val="0" :end-val="countData.violativeApplyCount" :duration="3600" class="card-panel-num" />
          </div>
        </div>
      </el-col> -->
    </el-row>

    <!-- <el-row>
      <el-col>
          <el-carousel height="30px" direction="vertical" >
            <el-carousel-item v-for="item in todoList" :key="item.id" > 
                <label> 
                  <i class="el-icon-bell" style="color: #fd9c0a;"></i>  
                  <span class="todoSpan">待审批通知： </span>
                  <a href="/office/todo" style="cursor:pointer">
                    <span class="todoSpanType" v-if="item.processDefinitionId.indexOf('leaveApply')>=0">请假申请</span>
                    <span class="todoSpanType" v-if="item.processDefinitionId.indexOf('quitApply')>=0">离职申请</span>
                    <span class="todoSpanType" v-if="item.processDefinitionId.indexOf('repairApply')>=0">维修申请</span>
                    <span class="todoSpanType" v-if="item.processDefinitionId.indexOf('usePersonApply')>=0">部门用人申请</span>
                    <span class="todoSpanType" v-if="item.processDefinitionId.indexOf('studentLeaveWithdrawal')>=0">学生请假(代提)</span>
                    <span class="todoSpanType" v-if="item.processDefinitionId.indexOf('goodsBuyApply')>=0">物品申购申请</span>
                    <span class="todoSpanType" v-if="item.processDefinitionId.indexOf('violativeApply')>=0">违纪申请</span>
                    <span class="todoSpanType" v-if="item.processDefinitionId.indexOf('visitApply')>=0">访客申请</span>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <span class="todoSpanTime">提交时间:{{parseTime(item.createTime)}}</span>
                  </a>
                </label>
            </el-carousel-item>
          </el-carousel>
        
      </el-col>
    </el-row> -->

    <el-row>
      <!-- <el-col :span="8">
        <el-tabs v-model="activeName"  style="padding:0px;width:90%">
          <el-tab-pane label="学生违纪数量" name="1">
            <div>
              <div ref="chart1" style="width:100%;height:300px" />
            </div>
          </el-tab-pane>
        </el-tabs>
      </el-col> -->
      <!-- <el-col :span="8">
        <el-tabs v-model="activeName1"  style="padding:0px;width:90%">
          <el-tab-pane label="学生请假数量" name="1">
            <div >
              <div ref="chart2" style="width:100%;height:300px" />
            </div>
          </el-tab-pane>
        </el-tabs>
      </el-col> -->
      <!-- <el-col :span="8">
        <el-tabs v-model="activeName2"  style="padding:0px;width:90%">
          <el-tab-pane label="老师请假数量" name="1">
            <div >
              <div ref="chart3" style="width:100%;height:300px" />
            </div>
          </el-tab-pane>
        </el-tabs>
      </el-col> -->
    </el-row>
    <!-- <el-row>
      <el-col >
        <el-tabs v-model="activeName2"  style="padding:0px;">
          <el-tab-pane label="老师请假数量" name="1">
            <div >
              <div ref="chart3" style="width:100%;height:300px" />
            </div>
          </el-tab-pane>
        </el-tabs>
      </el-col>
      
    </el-row>
     -->
    
    </div>
     

  </div>
</template>

<script>

import CountTo from 'vue-count-to'
import {countInfo,lastSenvenDayGroup,studentLeaveApply,lastOneMonthGroup} from '@/api/index'
import { findCurrUserToDoTasks } from "@/api/workflow/todo"

let map
export default {
  components: {
    CountTo
  },
  data() {
    return {
      userTotal: 0,
      goodsTotal: 0,
      productTotal: 0,
      orderTotal: 0,
      orderDate: [],
      paidCounts: [],
      unpaidCount: [],
      invalidCount: [],
      activeName: '1',
      activeName1:'1',
      activeName2:'1',
      orderReport: null,
      amountReport: null,
      dataList: [],
      choiceDate: null,
      isshow: null,
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now()
        }
      },
      countData:{},
      todoCount:0,
      todoList:[],
      lastSenvenDayGroup:{}
    }
  },
  mounted() {
    // this.initCharts1()
    // this.initCharts2()
    // this.initCharts3()
  },
  watch: {
    // activeName(v) {
    //   this.$nextTick(_ => {
    //     // this.$refs[`chart${v}`].echarts.resize()
    //     this.$echarts.init(this.$refs.chart1).resize()

    //   })
    //   this.initOrderCountCharts()
      
    // }
  },
  created() {
    this.initMap()
    // lastSenvenDayGroup().then(resp=>{
      // this.lastSenvenDayGroup = resp.data
      // this.initCharts1(resp.data)
      // this.$echarts.init(this.$refs.chart1).resize()
    // })
    // studentLeaveApply().then(resp=>{
    //   this.initCharts2(resp.data)
    // })

    // lastOneMonthGroup().then(resp=>{
    //   this.initCharts3(resp.data)
    // })
  },
  methods: {
    initMap(){
      countInfo().then(resp=>{
        this.countData = resp.data
        console.log(resp.data)
      })
      // const queryParams= {
      //   pageNum: 1,
      //   pageSize: 10,
      // } 
      // findCurrUserToDoTasks(queryParams).then(response => {
      //     this.todoList = response.data.list;
      //     this.todoCount = response.data.total;
          
      // })
    },
    findAmountReport() {
      
    },
    dividendsReportCharts() {
      
    },
    tabClick(tab, event) {
      
    },
    handleSetLineChartData(type) {
      
    },
    initCharts1(item) {
      console.log(this.$echarts)
      const myChart = this.$echarts.init(this.$refs.chart1)
      var option = {
        xAxis: {
          type: 'category',
          data: item.dayList,
          boundaryGap : false,
        },
        yAxis: {
          type: 'value',
          boundaryGap : false,
        },
        series: [
          {
            data:  item.countList,
            type: 'line'
          }
        ]
      };
      myChart.setOption(option)


    },
    initCharts2(item) {
      const myChart = this.$echarts.init(this.$refs.chart2)
      var option = {
        xAxis: {
          type: 'category',
          data: item.dayList
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            data: item.countList,
            type: 'line'
          }
        ]
      };
      myChart.setOption(option)


    },
    initCharts3(item) {
      const myChart = this.$echarts.init(this.$refs.chart3)
      var option = {
        xAxis: {
          type: 'category',
          data: item.dayList
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            data: item.countList,
            type: 'line'
          }
        ]
      };
      myChart.setOption(option)


    },
    chinaConfigure() {
        
      },
    convertData(data) {
      var res = [];
      for (var i = 0; i < data.length; i++) {
          // var geoCoord = this.geoCoordMap[data[i].name];
          // if (geoCoord) {
              res.push({
                  name: data[i].merchant_name,
                  value: [data[i].longitude,data[i].latitude,data[i].address]
              });
          // }
      }
      console.log('11',res)
      return res;
    }
    }
  }

</script>

<style rel="stylesheet/scss" lang="scss" >

.todoSpanType{
  font-size: 14px;
  color:#1890ff
}
.todoSpanTime{
  font-size: 14px;
  color:#9d9999
}
.todoSpan{
  font-size: 14px;
  color:#fd9c0a
}
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}
.el-tabs--border-card>.el-tabs__content {
    padding: 0px;
}
.panel-group {
  margin-top: 18px;

  .card-panel-col{
    margin-bottom: 32px;
  }
  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);
    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }
      .icon-people {
         background: #40c9c6;
      }
      .icon-message {
        background: #36a3f7;
      }
      .icon-money {
        background: #f4516c;
      }
      .icon-shoppingCard {
        background: #34bfa3
      }
    }
    .icon-people {
      color: #40c9c6;
    }
    .icon-message {
      color: #36a3f7;
    }
    .icon-money {
      color: #f4516c;
    }
    .icon-shoppingCard {
      color: #34bfa3
    }
    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }
    .card-panel-icon {
      float: left;
      font-size: 48px;
    }
    .card-panel-description {
      float: right;
      font-weight: bold;
      margin: 26px;
      margin-left: 0px;
      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }
      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}
</style>
